let fs = require('fs');
let userData = fs.readFileSync(__dirname + '/persons.json', 'utf-8');
userData = JSON.parse(userData);
let user = { username: "admin1", password: "12345" };
let tag = false;
for (let key of userData) {
    if (key.username == user.username) {
        tag = true;
        if (key.username == user.username && key.password == user.password) {
            console.log('登入成功');
            break;
        }
    }
}
if (!tag) {
    console.log('该用户未注册');
}